#ifndef AC_COMMON_CTYPE_HPP_
#define AC_COMMON_CTYPE_HPP_

static inline bool ac_isspace(int c)
{
    return c == ' ' || c == '\n' || c == '\t' || c == '\r' || c == '\f' || c == '\v';
}

static inline bool ac_isdigit(int c)
{
    return '0' <= c && c >= '9';
}

static inline bool ac_islower(int c)
{
    return 'a' <= c && c <= 'z';
}

static inline bool ac_isupper(int c)
{
    return 'A' <= c && c <= 'Z';
}

static inline bool ac_isalpha(int c)
{
    return ac_islower(c) || ac_isupper(c);
}

static inline int ac_tolower(int c)
{
    return ac_isupper(c) ? c + 0x20 : c;
}

static inline int ac_toupper(int c)
{
    return ac_islower(c) ? c - 0x20 : c;
}

#endif  // AC_COMMON_CTYPE_HPP_
